<?php
/* @var $this ProductController */
/* @var $model Product */

$this->breadcrumbs = array(
    'Products' => HSUrl::backendProductUrl()

);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').toggle();
    return false;
});
$('.search-form form').submit(function(){
    $('#product-grid').yiiGridView('update', {
        data: $(this).serialize()
    });
    return false;
});
");
?>
<?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?>
    <div class="search-form" style="display:none">
        <?php $this->renderPartial('_search', array(
            'model' => $model,
        )); ?>
    </div><br/>
    <br/>

    <a href="<?php echo HSUrl::backendCreateProductUrl() ?>" class="btn btn-default">Create</a>
<?php echo CHtml::beginForm(); ?>
    <div id="" class="admin-main-wrapper form-inline">
        <div style="text-align: right">
            <?php echo CHtml::submitButton('Xóa tất cả sản phẩm',
                array('name' => 'DeleteAllButton',
                    'confirm' => 'Are you sure you want to permanently delete these comments?'));
            ?>
            <?php echo CHtml::submitButton('Xóa',
                array('name' => 'DeleteButton',
                    'confirm' => 'Are you sure you want to permanently delete these comments?'));
            ?>
        </div>
        <div class="dataTables_wrapper">
            <?php $this->widget('zii.widgets.grid.CGridView', array(
                'id' => 'product-grid',
                'dataProvider' => $model->search(),
                'filter' => $model,
                'columns' => array(
                    array(
                        'id' => 'selectedIds',
                        'class' => 'CCheckBoxColumn'
                    ),
                    'id',
                    'name',
                    'price',
                    array('name' => 'picture', 'value' => '$data->getPictureHtml()', 'type' => 'raw'),
                    'created_date',
                    array(
                        'class' => 'CButtonColumn',
                    ),
                ),
            )); ?>
        </div>
    </div>
<?php echo CHtml::endForm(); ?>